Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sd75 31 posts 144 karma points
    Mar 29, 2013 @ 13:00
    sd75
    0

    Unexpected token '[' in the expression

    Using Darren Fergusons feedcache in conjunction with Warren Buckleys twitter for Umbraco (excellent packages) - I'm altering the TwitterStatus.xslt to get the xml from the cached xml file and not twitter directly -  see code below.

     <xsl:variable name="twitterXMLUrl" select="['../App_Data/FeedCache/mytwitter.xml']"/>

    however i get the error - Unexpected token '[' in the expression...... 

    I'm a bit of a xslt newbie - what is the best way to select an xml file with xsl variable?

    Many Thanks

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 29, 2013 @ 13:51
    Jan Skovgaard
    0

    Hi sd7

    Remove the square brackets [] and you should be fine.

    Hope this helps.

    /Jan

  • sd75 31 posts 144 karma points
    Mar 29, 2013 @ 14:25
    sd75
    0

    Cheers for quick post Jan

    I've tried this

    <xsl:variable name="twitterXMLUrl" select="../App_Data/FeedCache/mywitter.xml"/>

    I'm editing the file directly in Umbraco back office - it fails to save using the above code & throws a System.UriFormatException: Invalid URI: The URI is empty.

    I've tried 

    <xsl:variable name="twitterXMLUrl" select="document('../App_Data/FeedCache/mywitter.xml')"/> still doesn't work.

    I really need to get a decent book on xslt!

    Cheers

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 29, 2013 @ 14:37
    Jan Skovgaard
    0

    His sd75

    You removed more than I told you to do :)

    <xsl:variable name="twitterXmlUrl select="'../App_Data/FeedCache/mytwitter.xml'" /> - It's probably a bit hard to see that the single quotes are still in there. You could also do this <xsl:variable name="twitterXmlUrl" select="string(../App_Data/FeedCache/mytwitter.xml)" /> - This is probably easier to read.

    Hope this helps.

    Regarding a good XSLT source I think you should have a look at http://pimpmyxslt.com/articles/ - it's written by Chriztian Steinmeier who is a XSLT wizard and he is often helping people out with XSLT in these forums as well. The articles are written with Umbraco as context.

    Hope this helps.

    /Jan

  • sd75 31 posts 144 karma points
    Mar 29, 2013 @ 16:11
    sd75
    0

    Many Thanks Jan - I'll have a look. 

    On the twitter cache front  - I've replaced the following code from the twitter package:-

    <xsl:variable name="twitterXMLUrl" select="concat('http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=', $twitterUsername ,'&amp;include_rts=', $displayNativeRTs ,'&amp;exclude_replies=', $excludeReplies, '&amp;include_entities=1&amp;count=', $noStatus)"/>

    <!-- Go fetch the tweets & cache for 60 seconds -->

    <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl($twitterXMLUrl,'60')//statuses/status">

     <xsl:apply-templates mode="tweet" select="current()"/>

     </xsl:for-each>

     

    with this

    <xsl:variable name="twitterXMLUrl" select="string(../App_Data/FeedCache/mytwitter.xml)" />

     <xsl:for-each select="document($twitterXMLUrl)//statuses/status">

          <xsl:apply-templates mode="tweet" select="current()"/>

     </xsl:for-each>

     

    but back office fails to save the document. 

     

     

     

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Mar 29, 2013 @ 23:00
    Chriztian Steinmeier
    1

    Hi sd75,

    Even if you use the string() function, you still need to include the single quotes – so try this:

    <xsl:variable name="twitterXML" select="document('../App_Data/FeedCache/mytwitter.xml')" />
    
    <xsl:apply-templates select="$twitterXML//statuses/status" />

     

    /Chriztian

  • sd75 31 posts 144 karma points
    Apr 01, 2013 @ 12:55
    sd75
    0

    Many Thanks Chriztian - all good!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies